package com.tfswx.fljdmxyy.api;

import com.tfswx.fljdmxyy.dto.gnfl.*;
import com.tfswx.fljdmxyy.query.gnfl.GnQueryResult;
import com.tfswx.fljdmxyy.query.gnfl.GnflQueryParam;
import com.tfswx.fljdmxyy.query.gnfl.GnflQueryResult;
import com.tfswx.fljdmxyy.query.gnfl.GnxxQueryResult;
import com.tfswx.fljdmxyy.service.GnflService;
import com.tfswx.newbie.boot.starter.page.PageParam;
import com.tfswx.newbie.boot.starter.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 功能分类
 *
 * @author: 陈文佳
 * @date: 2022-10-13
 **/
@Slf4j
@RestController
@RequestMapping(value = "api/gnfl")
@Api(tags = "功能分类")
public class GnflController {

    @Resource
    private GnflService gnflService;

    @ApiOperation("新增功能分类")
    @PostMapping(value = "/addGnfl")
    public GnflAddOutputDTO addGnfl(@RequestBody @Validated GnflAddInputDTO dto) {
        return gnflService.addGnfl(dto);
    }

    @ApiOperation("修改功能分类")
    @PostMapping(value = "/updateGnfl")
    public Boolean updateGnfl(@RequestBody @Validated GnflUpdateInputDTO dto) {
        return gnflService.updateGnfl(dto);
    }

    @ApiOperation("获取功能分类")
    @PostMapping(value = "/getGnfl")
    public GnflGetOutputDTO getGnfl(@RequestBody @Validated GnflGetInputDTO dto) {
        return gnflService.getGnfl(dto);
    }

    @ApiOperation("删除功能分类")
    @PostMapping(value = "/deleteGnfl")
    public Boolean deleteGnfl(@RequestBody @Validated GnflDeleteInputDTO dto) {
        return gnflService.deleteGnfl(dto);
    }

    @ApiOperation("获取列表功能分类")
    @PostMapping(value = "/queryGnfl")
    public PageResult<GnflQueryResult> queryGnfl(@RequestBody @Validated PageParam<GnflQueryParam> param) {
        return gnflService.queryGnfl(param);
    }

    @ApiOperation("查询功能")
    @PostMapping(value = "/queryGnlb")
    public List<GnQueryResult> queryGnlb() {
        return gnflService.queryGnlb();
    }

    @ApiOperation("查询功能信息")
    @PostMapping(value = "/queryGnxx")
    public List<GnxxQueryResult> queryGnxx() {
        return gnflService.queryGnxx();
    }
}
